<template>
    <template v-if="hasAuth">
        <slot></slot>
    </template>
</template>

<script setup>
    import {ref,reactive} from 'vue'
    import store from '@/store';
    import {decryptByDES} from "@/utils/utils";
    var hasAuth = ref(false);

    // 定义获取属性
    const props = defineProps({
        code:{type:Array,default:[]}
    });

    // 根据属性判断hasAuth是否有权限
    const permissionList = store.getters["login/permissons"];
    var permissions = permissionList.map(p => decryptByDES(p.code) * 1);
    hasAuth.value = props.code.findIndex(v => permissions.includes(v)) != -1;
</script>